package com.imooc.order.controller;

import com.imooc.order.service.OrderService;
import com.imooc.order.vo.OrderCreateVo;
import lombok.extern.java.Log;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

/**
 * ProjectName order
 *
 * @author xieyucan
 * <br>CreateDate 2022/9/20 15:30
 */
@Slf4j
@RequestMapping("/order")
@RestController
public class OrderController {

    private final OrderService orderService;

    public OrderController(OrderService orderService) {
        this.orderService = orderService;
    }

    @PostMapping("/createOrder")
    public void createOrder(@RequestBody OrderCreateVo orderCreateVo) throws IOException, TimeoutException {
        log.info("createOrder:orderCreateVo:{}",orderCreateVo);
        orderService.createOrder(orderCreateVo);
    }
}
